/*
 * Copyright (c) 2016-2017 fulihui.com All right reserved
 * Project: integral-business-parent
 * File name: PropertiesServiceClientImpl.java
 */

package com.fulihui.integralbusiness.integration.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.fulihui.integralbusiness.integration.PropertiesServiceClient;
import com.fulihui.systemcore.api.PropertiesService;
import com.fulihui.systemcore.dto.PropertiesDTO;
import com.fulihui.systemcore.request.prop.PropertiesQueryRequest;
import org.near.servicesupport.result.TMultiResult;
import org.near.servicesupport.util.ServiceResultUtil;
import org.springframework.stereotype.Component;

import java.util.Collection;

/**
 * @author Willard.Hu on 2017/4/28 0028.
 */
@Component
public class PropertiesServiceClientImpl implements PropertiesServiceClient {
    @Reference(version = "1.0.0")
    private PropertiesService propertiesService;

    @Override
    public Collection<PropertiesDTO> query(PropertiesQueryRequest request) {
        TMultiResult<PropertiesDTO> res = propertiesService.queryMulti(request);
        ServiceResultUtil.checkResult(res);
        return res.getValues();
    }
}
